package com.example.nacoscloudconsumer.service;

import com.example.nacoscloudconsumer.config.FeignConfiguration;
import com.example.nacoscloudconsumer.entity.Article;
import com.example.nacoscloudconsumer.entity.Video;
import com.example.nacoscloudconsumer.fallback.EsFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(value = "elasticsearch", fallback = EsFallBack.class, configuration = FeignConfiguration.class)
public interface EsService {

    @RequestMapping( method = RequestMethod.GET, value = "/search/art/getPage", consumes = "application/json")
    List<Article> getArtPage(@RequestParam("content") String content, @RequestParam("title") String title);

    @RequestMapping(method = RequestMethod.GET, value = "/search/video/getPage", consumes = "application/json")
    List<Video> getVideoPage(@RequestParam("content") String content, @RequestParam("title") String title);

}

